package com.hoperun.checkcloth.ui.dialog

import android.app.Dialog
import android.os.Bundle
import androidx.appcompat.app.AlertDialog
import androidx.fragment.app.DialogFragment
import com.hoperun.checkcloth.R

class SimpleDialog : DialogFragment() {

    companion object {
        fun newInstance(message: String): SimpleDialog {
            return SimpleDialog().apply {
                val args = Bundle()
                args.putString("message", message)
                arguments = args
            }
        }
    }

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        val message = arguments?.getString("message", "")
        return AlertDialog.Builder(requireActivity())
                .setTitle(R.string.dialog_title_tip)
                .setMessage(message)
                .setPositiveButton(R.string.confirm) { _, _ -> dismissAllowingStateLoss() }
                .create()
    }

}